compat: make PHP 8 HTML escaping behavior explicit - #333
compat: make PHP 8 HTML escaping behavior explicit#333somethingwithproof wants to merge 4 commits into
Conversation
Cacti core now requires PHP >= 8.2, so the 8.1 integration job fails the composer platform check; Ubuntu Noble also lacks libapache2-mod-php for non-native versions without the ondrej PPA. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The updated HTML output still leaves a newly-touched localized attribute unescaped, and the CI workflow edits introduce reliability/scope concerns (add-apt-repository dependency + PHP 8.1 matrix drop) that should be resolved before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aims to make HTML escaping behavior consistent across PHP 8 versions by making the remaining htmlspecialchars() call explicit, and records the compatibility cleanup in the changelog. It also includes CI workflow adjustments affecting the PHP matrix and package installation steps.
Changes:
- Make
htmlspecialchars()behavior explicit by passingENT_QUOTES | ENT_SUBSTITUTEandUTF-8. - Add a develop changelog entry documenting the compatibility cleanup.
- Adjust GitHub Actions integration-test workflow (PHP matrix and apt repository setup).
File summaries
| File | Description |
|---|---|
setup.php |
Makes HTML escaping explicit for a generated syslog link in graph buttons. |
CHANGELOG.md |
Adds a develop entry noting the escaping/compatibility adjustment. |
.github/workflows/plugin-ci-workflow.yml |
Updates integration-test PHP matrix and modifies apt repository setup prior to installing Apache PHP packages. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - name: Run apt-get update | ||
| run: sudo apt-get update | ||
| run: | | ||
| sudo add-apt-repository -y ppa:ondrej/php | ||
| sudo apt-get update |
| $url = $config['url_path'] . 'plugins/syslog/syslog.php?tab=syslog&reset=1&host=' . $host_id . '&date1=' . $date1 . '&date2=' . $date2; | ||
|
|
||
| print "<a class='iconLink' href='" . htmlspecialchars($url, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "' title='" . __('Display Syslog in Range', 'syslog') . "'><i class='deviceRecovering fas fa-exclamation-triangle'></i></a><br>"; |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ['8.1', '8.2', '8.3'] | ||
| php: ['8.2', '8.3'] | ||
| os: [ubuntu-latest] |
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Install software-properties-common before add-apt-repository so the ondrej PPA step does not depend on an undeclared runner image package. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Summary
Audit result
A whole-plugin PHPCompatibility scan for PHP 8.0+ found five findings on develop. This PR resolves the htmlspecialchars() finding. The other four are omitted fputcsv() escape arguments and are already resolved in #326.
Validation
CI infrastructure repair #329 should merge first so this PR inherits the corrected PHP matrix after rebase.